<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>收藏的商家</title>
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../css/style_zj.css">
    <link rel="stylesheet" href="../layui/css/layui.css">
    <link rel="stylesheet" href="../fonts/iconfont.css">
</head>
<body>
<!--<div id="header_01_html">
    <iframe id="header_01" src="head_01.html" frameborder="0"></iframe>
</div>-->
<div class="content-box">
    <!--<div id="left_tab_html">
        <iframe id="left_tab" src="left_tab.html?x=3&y=1" frameborder="0"></iframe>
    </div>-->
    <div class="right-box layui-form" id="vue-box" v-cloak>
        <div class="content-admin">

            <div class="title-toggle">
                <div class="item active">客服管理</div>
                <div class="item"><a href="banner_admin.html">轮播设置</a></div>
                <a href="addCustomerPerson.html"><span class="btn-sty11 ml-20">新增客服</span></a>
            </div>
            <div>
                <div class="table-list">
                    <table>
                        <thead>
                        <tr>
                            <th>客服昵称</th>
                            <th>客服QQ</th>
                            <!--<th>品类</th>-->
                            <th class="width_170">添加时间</th>
                            <th class="width_170">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="item in pagList">
                            <td>{{item.airlinesName}}</td>
                            <td>
                                <span class="mr-8">{{item.airlinesQq}}</span>
                            </td>
                            <!--<td>完成</td>-->
                            <td class="">
                                {{item.crtTime}}
                            </td>
                            <td class="colo-blue cur-p js-alldel" :id="item.id">
                                删除
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <div id="test1" class="text-r"></div>
                </div>
            </div>


        </div>
    </div>
</div>

<!--<div>
    <iframe src="footer-record.html" style="width: 100%;border: none;height:60px;"></iframe>
</div>-->
<script src="../js/config.js"></script>

<script>
    var postData = {
        limit:4,
        offset:1,
    }

    var app = new Vue({
        el: '#vue-box',
        data: {
            pagList:'',
            imgBaseUrl: imgBaseUrl,
        },
        mounted:function(){
            this.getPage();
        },
        updated:function () {
            layui.use('form', function(){
                var form = layui.form;
                form.render("checkbox");
            });
        },
        methods:{
            getPage:function(){
                var that = this;
                get_ajaxPage("/stoteAirlines/getPage", postData, function (data) {
                    console.log(data);
                    that.pagList = data.data;
                    layui.use('laypage', function(){
                        var laypage = layui.laypage;
                        //执行一个laypage实例
                        laypage.render({
                            elem: 'test1'
                            ,count: data.count //数据总数，从服务端得到
                            ,limit:postData.limit
                            ,jump: function(obj, first){
                                //obj包含了当前分页的所有参数，比如：
                                console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                                console.log(obj.limit); //得到每页显示的条数

                                //首次不执行
                                if(!first){
                                    //do something
                                    postData.offset = obj.curr;
                                    get_ajaxPage("/stoteAirlines/getPage", postData, function (data) {
                                        that.pagList = data.data;
                                    })
                                }
                            }
                        });
                    });
                })



            }
        }
    });
    layui.use('form', function(){  //2级联动
        var form = layui.form;
        form.render("checkbox");
        form.on('checkbox(checkAll)', function(data){    //layui-触发事件
            var checked = data.elem.checked;
            $("tbody input[type=checkbox]").prop("checked",checked);
            form.render("checkbox");
        });
        form.on('checkbox(checkIt)', function(data){
            var checked = data.elem.checked;
            var allLength = $("tbody input[type=checkbox]").length;
            var checkLength = $("tbody input[type=checkbox]:checked").length;
            $("#checkAll").prop("checked",allLength == checkLength);
            form.render("checkbox");
        });
    });


    $(document).on('click','.js-alldel',function(){   //删除客服
        get_ajax("/stoteAirlines/delInfo", {id:$(this).attr('id')}, function (data) {
            console.log(data);
            layer.msg('删除成功！');
            app.getPage();
        })
    })

</script>
</body>
</html>